\(\int \text {csch}(c+d x) (a+b \tanh ^2(c+d x)) \, dx\) [5]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 26 \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {a \text {arctanh}(\cosh (c+d x))}{d}-\frac {b \text {sech}(c+d x)}{d} \]

[Out]

-a*arctanh(cosh(d*x+c))/d-b*sech(d*x+c)/d

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3745, 396, 213} \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {a \text {arctanh}(\cosh (c+d x))}{d}-\frac {b \text {sech}(c+d x)}{d} \]

[In]

Int[Csch[c + d*x]*(a + b*Tanh[c + d*x]^2),x]

[Out]

-((a*ArcTanh[Cosh[c + d*x]])/d) - (b*Sech[c + d*x])/d

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 3745

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[(-1 + ff^2*x^2)^((m - 1)/2)*((a - b + b*ff^2*x^2)^p/x^(m
 + 1)), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {a+b-b x^2}{-1+x^2} \, dx,x,\text {sech}(c+d x)\right )}{d} \\ & = -\frac {b \text {sech}(c+d x)}{d}+\frac {a \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\text {sech}(c+d x)\right )}{d} \\ & = -\frac {a \text {arctanh}(\cosh (c+d x))}{d}-\frac {b \text {sech}(c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 52, normalized size of antiderivative = 2.00 \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {a \log \left (\cosh \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}{d}+\frac {a \log \left (\sinh \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}{d}-\frac {b \text {sech}(c+d x)}{d} \]

[In]

Integrate[Csch[c + d*x]*(a + b*Tanh[c + d*x]^2),x]

[Out]

-((a*Log[Cosh[c/2 + (d*x)/2]])/d) + (a*Log[Sinh[c/2 + (d*x)/2]])/d - (b*Sech[c + d*x])/d

Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.04

method result size
derivativedivides \(\frac {-2 a \,\operatorname {arctanh}\left ({\mathrm e}^{d x +c}\right )-\frac {b}{\cosh \left (d x +c \right )}}{d}\) \(27\)
default \(\frac {-2 a \,\operatorname {arctanh}\left ({\mathrm e}^{d x +c}\right )-\frac {b}{\cosh \left (d x +c \right )}}{d}\) \(27\)
risch \(-\frac {2 b \,{\mathrm e}^{d x +c}}{d \left ({\mathrm e}^{2 d x +2 c}+1\right )}+\frac {a \ln \left ({\mathrm e}^{d x +c}-1\right )}{d}-\frac {a \ln \left ({\mathrm e}^{d x +c}+1\right )}{d}\) \(56\)

[In]

int(csch(d*x+c)*(a+b*tanh(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(-2*a*arctanh(exp(d*x+c))-b/cosh(d*x+c))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 167 vs. \(2 (26) = 52\).

Time = 0.25 (sec) , antiderivative size = 167, normalized size of antiderivative = 6.42 \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {2 \, b \cosh \left (d x + c\right ) + {\left (a \cosh \left (d x + c\right )^{2} + 2 \, a \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a \sinh \left (d x + c\right )^{2} + a\right )} \log \left (\cosh \left (d x + c\right ) + \sinh \left (d x + c\right ) + 1\right ) - {\left (a \cosh \left (d x + c\right )^{2} + 2 \, a \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a \sinh \left (d x + c\right )^{2} + a\right )} \log \left (\cosh \left (d x + c\right ) + \sinh \left (d x + c\right ) - 1\right ) + 2 \, b \sinh \left (d x + c\right )}{d \cosh \left (d x + c\right )^{2} + 2 \, d \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + d \sinh \left (d x + c\right )^{2} + d} \]

[In]

integrate(csch(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="fricas")

[Out]

-(2*b*cosh(d*x + c) + (a*cosh(d*x + c)^2 + 2*a*cosh(d*x + c)*sinh(d*x + c) + a*sinh(d*x + c)^2 + a)*log(cosh(d
*x + c) + sinh(d*x + c) + 1) - (a*cosh(d*x + c)^2 + 2*a*cosh(d*x + c)*sinh(d*x + c) + a*sinh(d*x + c)^2 + a)*l
og(cosh(d*x + c) + sinh(d*x + c) - 1) + 2*b*sinh(d*x + c))/(d*cosh(d*x + c)^2 + 2*d*cosh(d*x + c)*sinh(d*x + c
) + d*sinh(d*x + c)^2 + d)

Sympy [F]

\[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\int \left (a + b \tanh ^{2}{\left (c + d x \right )}\right ) \operatorname {csch}{\left (c + d x \right )}\, dx \]

[In]

integrate(csch(d*x+c)*(a+b*tanh(d*x+c)**2),x)

[Out]

Integral((a + b*tanh(c + d*x)**2)*csch(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.54 \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {a \log \left (\tanh \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}{d} - \frac {2 \, b}{d {\left (e^{\left (d x + c\right )} + e^{\left (-d x - c\right )}\right )}} \]

[In]

integrate(csch(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="maxima")

[Out]

a*log(tanh(1/2*d*x + 1/2*c))/d - 2*b/(d*(e^(d*x + c) + e^(-d*x - c)))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 68 vs. \(2 (26) = 52\).

Time = 0.28 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.62 \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {a \log \left (e^{\left (d x + c\right )} + e^{\left (-d x - c\right )} + 2\right ) - a \log \left (e^{\left (d x + c\right )} + e^{\left (-d x - c\right )} - 2\right ) + \frac {4 \, b}{e^{\left (d x + c\right )} + e^{\left (-d x - c\right )}}}{2 \, d} \]

[In]

integrate(csch(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="giac")

[Out]

-1/2*(a*log(e^(d*x + c) + e^(-d*x - c) + 2) - a*log(e^(d*x + c) + e^(-d*x - c) - 2) + 4*b/(e^(d*x + c) + e^(-d
*x - c)))/d

Mupad [B] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 64, normalized size of antiderivative = 2.46 \[ \int \text {csch}(c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {2\,\mathrm {atan}\left (\frac {a\,{\mathrm {e}}^{d\,x}\,{\mathrm {e}}^c\,\sqrt {-d^2}}{d\,\sqrt {a^2}}\right )\,\sqrt {a^2}}{\sqrt {-d^2}}-\frac {2\,b\,{\mathrm {e}}^{c+d\,x}}{d\,\left ({\mathrm {e}}^{2\,c+2\,d\,x}+1\right )} \]

[In]

int((a + b*tanh(c + d*x)^2)/sinh(c + d*x),x)

[Out]

- (2*atan((a*exp(d*x)*exp(c)*(-d^2)^(1/2))/(d*(a^2)^(1/2)))*(a^2)^(1/2))/(-d^2)^(1/2) - (2*b*exp(c + d*x))/(d*
(exp(2*c + 2*d*x) + 1))